package adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.ArrayList;

/**
 * 启动液的时候需要使用这一个来切换页面
 * FragmentPagerAdapter:如果Fragment数量相对来说较少,并且每个Fragment里面的数据不怎么经常更新.
 * FragmentStatePagerAdapter:如果Fragment数量比较多,并且每个Fragment里面的数据经常性更新.
 * Created by Administrator on 2016/9/10.
 */
public class FragmentAdapter extends FragmentPagerAdapter {
    private ArrayList<Fragment> mList;
    public FragmentAdapter(FragmentManager fm, ArrayList<Fragment> fragments) {
        super(fm);
        this.mList = fragments;
    }

    @Override
    public Fragment getItem(int position) {
        return mList.get(position);
    }

    @Override
    public int getCount() {
        return mList.size();
    }
}
